import urllib.request 
import re

# python 随机数
import random 
uapools=[
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36 Edg/80.0.361.69"
]
def UA():
  opener = urllib.request.build_opener()
  nowua = random.choice(uapools)
  ua = ("User-Agent", nowua )
  opener.addheaders = [ua]
  urllib.request.install_opener(opener)

cursor="6444385518324774739"
url = "https://video.coral.qq.com/varticle/1641090003/comment/v2?"
pat = '"content":"(.*?)"'
cursorPat = '"last":"(.*?)"'
contentmo = re.compile(pat,re.S) 
cursormo = re.compile(cursorPat,re.S)

for i in range(0,5):
  print("第"+str(i)+"页数据")
  param = "callback=_varticle1641090003commentv2&orinum=10&oriorder=o&pageflag=1&cursor="+cursor+"&scorecursor=0&orirepnum=2&reporder=o&reppageflag=1&source=132&_=1588576332400"
  UA()
  data = urllib.request.urlopen(url+param).read().decode("utf-8","ignore")
  comment  = contentmo.findall(data)
  for e in comment  :
    print("-----"+e)
  cursor = cursormo.findall(data)[0]